/* eslint-disable */
'use strict';

module.exports = app => {
  const { DATE, BIGINT } = app.Sequelize;
  const Favorite = app.model.define('favorite', {
    id: { type: BIGINT, primaryKey: true, autoIncrement: true },
    user_id: {
      type: BIGINT,
      allowNull: false,
    },
    outfit_id: {
      type: BIGINT,
      allowNull: false,
    },
    created_at: DATE,
    updated_at: DATE,
  }, {
    tableName: 't_favorite',
  });

  Favorite.associate = function () {
    app.model.Favorite.belongsTo(app.model.User, {
      foreignKey: 'user_id',
      as: 'user'
    })
    app.model.Favorite.belongsTo(app.model.Outfit, {
      foreignKey: 'outfit_id',
      as: 'outfit'
    })
  }
  return Favorite;
};
